package com.googlecode.tracey.ui.core;

import com.googlecode.utterlyidle.RequestBuilder;
import com.googlecode.utterlyidle.annotations.GET;
import com.googlecode.utterlyidle.annotations.Path;
import com.googlecode.utterlyidle.annotations.QueryParam;
import com.googlecode.utterlyidle.handlers.HttpClient;

@Path("extension")
public class ExtensionResource {
    private final HttpClient httpClient;

    public ExtensionResource(HttpClient httpClient) {
        this.httpClient = httpClient;
    }

    @GET
    public Object get(@QueryParam("url") String url) throws Exception {
        return httpClient.handle(RequestBuilder.get("/static/make-printable.html").build()).entity().toString();
    }
}
